package com.recharge.core.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.recharge.core.entity.DepositEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 存款单表 Mapper 接口
 * </p>
 *
 * @author reagan
 * @since 2020-08-19
 */
@Mapper
public interface DepositMapper extends BaseMapper<DepositEntity> {

    /**
     * 查询存款列表并分页
     *
     * @return
     */
//    IPage<DepositEntity> selectListAndPage(@Param("page") Page page, @Param("param") Map<String, Object> param);

    /**
     * 根据主键ID查询详细存款信息
     *
     * @param list
     * @return
     */
    List<DepositEntity> getByIds(List<String> list);

    @Select("SELECT COUNT(1) FROM business_deposit WHERE merchant_id = #{merchantId} AND is_delete = 1 AND `status` = #{status} AND `type` = 4;")
    int getCreditCount(String merchantId, int status);

    IPage<DepositEntity> selectInfoPage(Page<DepositEntity> page, @Param("ew") QueryWrapper<DepositEntity> wrapper);
}
